package main

import "fmt"

type person struct {
	id   int
	name string
	sex  string
}

type student struct {
	person
	score int
}

func (p *person) PrintInfo() {
	fmt.Println("父类", p)
}

func (s *student) PrintInfo() {
	fmt.Println("子类", s)
}

func main() {
	s := student{person{1, "zs", "男"}, 99}
	s.PrintInfo()
	fmt.Println(s.PrintInfo)
	fmt.Println(s.person.PrintInfo)

	//方法类型
	f := s.PrintInfo
	fmt.Printf("%T\n", f) //output:func()
	f()
}
